home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Software Vault: The Gold Collection
/
Software Vault - The Gold Collection (American Databankers) (1993).ISO
/
cdr11
/
cuj9303.zip
/
1103101A
< prev
next >
Wrap
Text File
|
1993-06-21
|
1KB
|
58 lines
// date8.h
// Forward declarations
class istream;
class ostream;
class Date
{
int month;
int day;
int year;
static int dtab[2][13];
public:
// Constructors
Date(); // Get today's date (see .cpp file)
Date(int m, int d, int y)
{month = m; day = d; year = y;}
// Accessor Functions
int get_month() const
{return month;}
int get_day() const
{return day;}
int get_year() const
{return year;}
Date operator-(const Date& d2) const;
Date& operator-()
{month = -month; day = -day; year = -year;
return *this;}
int compare(const Date&) const;
// Relational operators
int operator<(const Date& d2) const
{return compare(d2) < 0;}
int operator<=(const Date& d2) const
{return compare(d2) <= 0;}
int operator>(const Date& d2) const
{return compare(d2) > 0;}
int operator>=(const Date& d2) const
{return compare(d2) >= 0;}
int operator==(const Date& d2) const
{return compare(d2) == 0;}
int operator!=(const Date& d2) const
{return compare(d2) != 0;}
// Stream I/O operators
friend ostream& operator<<(ostream&, const Date&);
friend istream& operator>>(istream&, Date&);
static int isleap(int y)
{return y%4 == 0 && y%100 != 0 || y%400 == 0;}
};